Бляди тоже ок, ага. Войти !bnw Сегодня Клубы
Привет, TbI — HRWKA! 1235.1 пользователей не могут ошибаться!
?6907
прекрасное6424
говно5887
говнорашка5512
хуита4695
anime3056
linux2645
music2620
bnw2588
рашка2560
log2337
ололо2113
pic1812
дунч1734
сталирасты1488
украина1437
быдло1434
bnw_ppl1370
дыбр1237
гімно1158

https://blog.racket-lang.org/2017/10/racket-v6-11.html

Typed Racket supports refinement types and dependent function types. Previously
an experimental feature, refinement types allow types to describe more
interesting properties of values, especially integers. For example, this type
shows that the max function always produces a number at least as big as its
inputs:

(-> ([x : Integer] [y : Integer])
(Refine [z : Integer]
(and (>= z x) (>= z y))))

#JMH83R (6) / @ninesigns / 2365 дней назад

ADTs in Typed Racket with macros

Немного изящного (макроебства)[http://lexi-lambda.github.io/blog/2015/12/21/adts-in-typed-racket-with-macros/] и в тайпед/ракетке можно юзать ADT с паттерн матчингом.
(Прямо как во взрослых крутых языках).

(define-datatype Expr
  (Value Number)
  (Add Expr Expr)
  (Subtract Expr Expr)
  (Multiply Expr Expr)
  (Divide Expr Expr))

(: evaluate (Expr -> Number))
(define (evaluate e)
  (match e
    [(Value x)      x                            ]
    [(Add a b)      (+ (evaluate a) (evaluate b))]
    [(Subtract a b) (- (evaluate a) (evaluate b))]
    [(Multiply a b) (* (evaluate a) (evaluate b))]
    [(Divide a b)   (/ (evaluate a) (evaluate b))]))

> (evaluate (Add (Value 1)

                 (Multiply (Divide (Value 1) (Value 2))
                           (Value 7))))
4 1/2

Интересно, ебанется ли кто-нить достаточно чтобы набыдлить какой-нить аналог хаскеля или scalaz?

#R60TPL (14) / @ninesigns / 3043 дня назад

Просто и элегантно.
Спасибо динамической типизации!

#lang racket
(require math)
(require racket/match)

(define (inverse func)
  (match func
    ['exp log]
    ['cos acos]
    [_ #f]))

(printf "Inv[~a](~a) = ~a\n" 'exp (exp 1) ((inverse 'exp) (exp 1)))
(printf "Inv[~a](~a) = ~a\n" 'cos 1       ((inverse 'cos) 1))

http://pasterack.org/pastes/74110

Inv[exp](2.718281828459045) = 1.0
Inv[cos](1) = 0

#F6MJXE (39) / @ninesigns / 3057 дней назад

Новая ракетка вышла.

Roughly, hygienic macro expansion is desirable for the same reason as lexical scope: both enable local reasoning about binding so that program fragments compose reliably. The analogy suggests specifying hygienic macro expansion as a kind of translation into lexical-scope machinery. In that view, variables must be renamed to match the mechanisms of lexical scope as macro expansion proceeds. A specification of hygiene in terms of renaming accommodates simple binding forms well, but it becomes unwieldy for recursive definition contexts (Flatt et al. 2012, section 3.8), especially for contexts that allow a mixture of macro and non-macro definitions. The renaming approach is also difficult to implement compactly and efficiently in a macro system that supports “hygiene bending” operations, such as datum->syntax, because a history of renamings must be recorded for replay on an arbitrary symbol.

In a new macro expander for Racket, we discard the renaming approach and start with a generalized idea of macro scope, where lexical scope is just a special case of macro scope when applied to a language without macros. Roughly, every binding form and macro expansion creates a scope, and each fragment of syntax acquires a set of scopes that determines binding of identifiers within the fragment. In a language without macros, each scope set is identifiable by a single innermost scope. In a language with macros, identifiers acquire scope sets that overlap in more general ways.

http://www.cs.utah.edu/plt/scope-sets/index.html

#U252BB (0) / @ninesigns / 3071 день назад

The Racket Manifesto
http://www.ccs.neu.edu/home/matthias/manifesto/index.html

The creation of a programming language calls for guiding principles that point the developers to goals. This article spells out the three basic principles behind the 20-year development of Racket. First, programming is about stating and solving problems, and this activity normally takes place in a context with its own language of discourse; good programmers ought to formulate this language as a programming language. Hence, Racket is a programming language for creating new programming languages. Second, by following this language-oriented approach to programming, systems become multi-lingual collections of interconnected components. Each language and component must be able to protect its specific invariants. In support, Racket offers protection mechanisms to implement a full language spectrum, from C-level bit manipulation to soundly typed extensions. Third, because Racket considers programming as problem solving in the correct language, Racket also turns extra-linguistic mechanisms into linguistic constructs, especially mechanisms for managing resources and projects. The paper explains these principles and how Racket lives up to them, presents the evaluation framework behind the design process, and concludes with a sketch of Racket’s imperfections and opportunities for future improvements.

#8R7E5K (6) / @ninesigns / 3183 дня назад

Поставил racket-mode. Вроде нормас.

#49WYK3 (0) / @ninesigns / 3439 дней назад

Вчера кто-то, похожий на ляха, вышел на связь.

<chare> why should we use Racket over Haskell?
<bremner> maybe you shouldn't. What are you looking for?
<chare> so explain to me why use Racket over Haskel
<Jooles> chare, explain to me blue over yellow
<Jooles> it's not as simple as that
<chare> so explain why its not simple
<bremner> chare: c'mon, either engage, or stop trolling.
<chare> you guys are the experts on racket not me

#339G2C (6) / @ninesigns / 3445 дней назад

YAY, racket 6.1.1 is out.

#QG2C4X (0) / @ninesigns / 3457 дней назад

На лоре опять выходит на связь упоротый жаваскриптер со своими охуительными вопросами.

На этот раз он утверджает что поскольку в JS apply принимает дополнительный параметр - объект, this которого будет активным во время функции, которую вызывает apply, то это является более мощной АБОСРАКЦИЕЙ.

Хуйта канеш. От нечего делать накидал подобную херню в схемке. ths лексически биндится на передаваемый объект в теле функции.

#lang racket
(require syntax/parse/define)
(require racket/stxparam)

(define-syntax-parameter ths 
    (lambda (stx) (raise-syntax-error #f "Not used inside js-apply!" stx)))

(define-simple-macro (js-apply obj:expr fn:expr args...)
  (let ([this-obj obj])
    (syntax-parameterize ([ths (make-rename-transformer #'this-obj)])
             (apply fn args...))))


(js-apply (new (class object% 
         (super-new) 
         (init-field [x 10])))
      (lambda (y) (+ y (get-field x ths)))
      (list 1))

;; 11
#9PE2ER (22) / @ninesigns / 3465 дней назад
говно > Typed Racket’s local type inference algorithm is currently not able to infer types for polymorphic functions that are used on higher-order arguments that are themselves polymorphic.
#G12IRB (0) / @ninesigns / 3486 дней назад
tfw кто-то реализовал твою задумку быстрее тебя https://www.youtube.com/watch?v=t3xdv4UP9-U
#COHG20 (0) / @ninesigns / 3490 дней назад
Чятик, как в твоем любимом говноязычке делается такая херня -> http://pasterack.org/pastes/18033 То есть нагенерить пачку классов (не объектов, так что JS-питухи сразу идут лесом), которые параметризованы лямбдочками. Я попытался сделать на говноплюсах и высрал примерно вот енто -> http://ideone.com/AZBy69 но чото кал какой-то.
#O78N84 (31) / @ninesigns / 3492 дня назад
Ох блять, наебался вдоволь с этим новым списком контактов, и он еще подглючивает - не скроллится при выборе стрелками, вешает нахер интерфейс при ресайзе, рисует нижнюю полоску прокрутки, да и иконки походу слишком большие. Иногда (когда?) не снимается выделение с контакта и их получается сразу два.
#WIFIVM (7) / @ninesigns / 3499 дней назад

Родилось в одним из диалогов с дедфудом.

Позволяет юзать синтаксис как у околохацкеля чтобы задавать значения и объявлять лямбдочки.
Для полноценной костылезации надо переопределять свой reader через #lang, что делать конечно лень.

;; gayfood.rkt
#lang racket

(require syntax/parse)
(require (for-syntax syntax/parse))
(provide (all-defined-out))

(begin-for-syntax
 (define-syntax-class gaylambda
   #:literals (->)
   (pattern (-> (arg:id ...) body:expr))))

(define-syntax (-> stx)
  (syntax-parse stx
                [f:gaylambda #'(lambda (f.arg ...) f.body)]))

(define-syntax (= stx)
  (syntax-parse stx
                #:literals (=)
                [(= a:id b:expr) #'(define a b)]))
;; test
#lang sweet-exp racket
require("gayfood.rkt")

{ closureLambda = {(i) -> {i * i}} }

printf("closureLambda(10) = ~a\n" closureLambda(10)) 

выводит 100, охуеть, правда?

#TWRFWN (1) / @ninesigns / 3514 дней назад

Интервью с одним из авторов ракетки.
http://blog.cognitect.com/cognicast/061-matthew-flatt

#UGDVIJ (2) / @ninesigns / 3520 дней назад

Нашел одну херотень в ракетке.
Когда tox присылет асинхронно сообщения, то контрол editor иногда кидает эксепшеном что мол метод insert вызван на залоченом редакторе и идите нахуй:

sequence-contract-violation: negative: method insert cannot be called, except in states (unlocked)

Такое проявляется если tox начинает срать безостановочно кучей сообщений с мелким интервалом (спасибо штилетте)

Пока навернул такой костыль, но это жуткая ебанина, буду долбиться в их список рассылки за объяснениями.
```
(call/cc
(lambda (cc)
(with-handlers ([exn:fail?
(lambda (ex)
(sleep 1)
(cc))])

       (send editor insert message))))
#BG5SK5 (4) / @ninesigns / 3530 дней назад

Eduardo Costa writes:

Is there anything in the semantic of Python that makes it much more difficult to
implement a Python compiler than a Racket compiler?

Python is much more dynamic than Racket. As an illustration, look at a simple
operation: addition. In Racket,

(+ a b)

requires dispatching on the types of a and, from a finite (and small)
list of admitted candidates (fixnum, flonum, ...). Anything else is an error.

In Python,

a + b

is just syntactic sugar for

a.__add__(b)

which means (1) Look up the type of a, (2) look up 'add' in the
method dictionary of that type and its supertypes, (3) if not found,
look up 'radd' in the method dictionary of the type of b, (4) call
the resulting method. None of the intermediate lookups can be cached
because everything might be different the next time that operation is
executed: a and b can have different types, and the definition of
add for the types of a and b can have changed.

Konrad.

лан.

#FGQ32N (1) / @ninesigns / 3573 дня назад

racket 6.0 вышел:

* новый пакетный манагер
* базавая установка распилена на > 200 пакетов
* компилятор JIT для arm
* значительный улучшения производительности в typed/racket
* Новый профайлер для контрактов сообщает как долго проверяются контракты.
(дохера важная фича кстати)

http://blog.racket-lang.org/2014/02/racket-v60.html

#NPREW7 (5) / @ninesigns / 3707 дней назад
ipv6 ready BnW для ведрофона BnW на Реформале Викивач Котятки

Цоперайт © 2010-2016 @stiletto.