[swift-users] read data from the code

Bee bee.ography at gmail.com
Sat Dec 12 08:25:22 CST 2015


Well, it's not really what I want as it still has a custom function (READ).
I think it's not possible in Swift. It's alright, let's move on. Thank you,
anyway. :)


On Sat, Dec 12, 2015 at 3:37 PM, David Turnbull via swift-users <
swift-users at swift.org> wrote:

> I couldn't figure out a way to bring back line numbers but here's READ and
> DATA...
>
> // Define your data
>
> let DATA = [5,7,1,6,7]
>
> // Change the Int below to whatever type of DATA you have
>
> let READ = {() -> () -> Int
>
>     in var g=DATA.generate();return {()in return g.next()!}}()
>
> // And now you read
>
> print( READ() )
>
> print( READ() + READ() )
>
> print( READ() * READ() )
>
>
> It's like magic and stuff.
>
> -david
>
>
>
> On Fri, Dec 11, 2015 at 10:46 PM, Bee via swift-users <
> swift-users at swift.org> wrote:
>
>> Hi all,
>>
>> Does anyone here remember gwbasic? There is one feature of gwbasic that I
>> miss from modern programming language. It's the pair of READ function and
>> DATA statement. An example here:
>> http://www.antonis.de/qbebooks/gwbasman/data.html
>>
>>
>>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>


-- 
-Bee-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151212/a255b81d/attachment.html>


More information about the swift-users mailing list